// 实验组件：分光计实验 //
功能：本实验通过分光计测量不同光谱线的衍射角，计算光的波长并与标准值进行对比分析。实验包括光谱测量和三棱镜面角测量两个部分。
// 作者：Felix // 日期：2025-01-13
<script setup lang="ts">
import { ref } from "vue";

// 定义光谱线数据结构
interface SpectralLine {
  color: "蓝" | "绿" | "黄1" | "黄2"; // 光谱线颜色
  readings: {
    level: "+1" | "-1"; // 衍射级数
    theta1: {
      // 第一次测量角度
      degrees: number | null; // 度数
      minutes: number | null; // 分数
    };
    theta2: {
      // 第二次测量角度
      degrees: number | null;
      minutes: number | null;
    };
  }[];
}

// 定义处理后的数据结构
interface ProcessedData {
  phi1: number | null; // 第一次测量的衍射角
  phi2: number | null; // 第二次测量的衍射角
  phiAvg: number | null; // 平均衍射角
  lambda: number | null; // 计算得到的波长
  lambdaStd: number; // 标准波长
  deltaLambda: number | null; // 波长差
  error: number | null; // 相对误差
}

// 初始化光谱线数据
const spectralLines = ref<SpectralLine[]>([
  {
    color: "蓝",
    readings: [
      {
        level: "+1",
        theta1: { degrees: null, minutes: null },
        theta2: { degrees: null, minutes: null },
      },
      {
        level: "-1",
        theta1: { degrees: null, minutes: null },
        theta2: { degrees: null, minutes: null },
      },
    ],
  },
  {
    color: "绿",
    readings: [
      {
        level: "+1",
        theta1: { degrees: null, minutes: null },
        theta2: { degrees: null, minutes: null },
      },
      {
        level: "-1",
        theta1: { degrees: null, minutes: null },
        theta2: { degrees: null, minutes: null },
      },
    ],
  },
  {
    color: "黄1",
    readings: [
      {
        level: "+1",
        theta1: { degrees: null, minutes: null },
        theta2: { degrees: null, minutes: null },
      },
      {
        level: "-1",
        theta1: { degrees: null, minutes: null },
        theta2: { degrees: null, minutes: null },
      },
    ],
  },
  {
    color: "黄2",
    readings: [
      {
        level: "+1",
        theta1: { degrees: null, minutes: null },
        theta2: { degrees: null, minutes: null },
      },
      {
        level: "-1",
        theta1: { degrees: null, minutes: null },
        theta2: { degrees: null, minutes: null },
      },
    ],
  },
]);

// 标准波长值（单位：微米）- 用于计算误差
const standardWavelengths = {
  蓝: 0.4358,
  绿: 0.5461,
  黄1: 0.577,
  黄2: 0.5791,
};

// 光栅常数（单位：毫米）- 用于波长计算
const gratingConstant = 1 / 300;

// 计算波长
const calculateWavelength = (phi: number) => {
  return gratingConstant * Math.sin((phi * Math.PI) / 180);
};

// 计算相对误差
const calculateError = (color: string, measuredWavelength: number) => {
  const standardWavelength =
    standardWavelengths[color as keyof typeof standardWavelengths];
  return ((measuredWavelength - standardWavelength) / standardWavelength) * 100;
};

// 初始化处理后的数据
const processedData = ref<Record<string, ProcessedData>>({
  蓝: {
    phi1: null,
    phi2: null,
    phiAvg: null,
    lambda: null,
    lambdaStd: 0.4358,
    deltaLambda: null,
    error: null,
  },
  绿: {
    phi1: null,
    phi2: null,
    phiAvg: null,
    lambda: null,
    lambdaStd: 0.5461,
    deltaLambda: null,
    error: null,
  },
  黄1: {
    phi1: null,
    phi2: null,
    phiAvg: null,
    lambda: null,
    lambdaStd: 0.577,
    deltaLambda: null,
    error: null,
  },
  黄2: {
    phi1: null,
    phi2: null,
    phiAvg: null,
    lambda: null,
    lambdaStd: 0.5791,
    deltaLambda: null,
    error: null,
  },
});

// 三棱镜测量数据
const prismData = ref({
  line1Position1: {
    degrees: null as number | null,
    minutes: null as number | null,
  },
  line1Position2: {
    degrees: null as number | null,
    minutes: null as number | null,
  },
  line2Position1: {
    degrees: null as number | null,
    minutes: null as number | null,
  },
  line2Position2: {
    degrees: null as number | null,
    minutes: null as number | null,
  },
  diffI: null as number | null,
  diffII: null as number | null,
  A: null as number | null,
});

// 工具函数：将度分转换为小数形式
const convertToDecimal = (
  degrees: number | null,
  minutes: number | null
): number | null => {
  if (degrees === null || minutes === null) return null;
  return degrees + minutes / 60;
};

// 工具函数：将小数形式的角度转换为度分秒格式
const formatToDMS = (decimalDegrees: number | null): string => {
  if (decimalDegrees === null) return "-";

  const degrees = Math.floor(Math.abs(decimalDegrees));
  const minutesDecimal = (Math.abs(decimalDegrees) - degrees) * 60;
  const minutes = Math.floor(minutesDecimal);
  const seconds = Math.round((minutesDecimal - minutes) * 60);

  const sign = decimalDegrees < 0 ? "-" : "";
  return `${sign}${degrees}°${minutes}'${seconds}"`;
};

// 计算光谱数据
const calculateProcessedData = () => {
  spectralLines.value.forEach((line) => {
    const data = processedData.value[line.color];
    const readings = line.readings;

    // 计算第一次测量的衍射角 φI = (θI- - θI+)/2
    const theta1Plus = convertToDecimal(
      readings[0].theta1.degrees,
      readings[0].theta1.minutes
    );
    const theta1Minus = convertToDecimal(
      readings[1].theta1.degrees,
      readings[1].theta1.minutes
    );
    if (theta1Plus !== null && theta1Minus !== null) {
      data.phi1 = (theta1Minus - theta1Plus) / 2;
    }

    // 计算第二次测量的衍射角 φII = (θII- - θII+)/2
    const theta2Plus = convertToDecimal(
      readings[0].theta2.degrees,
      readings[0].theta2.minutes
    );
    const theta2Minus = convertToDecimal(
      readings[1].theta2.degrees,
      readings[1].theta2.minutes
    );
    if (theta2Plus !== null && theta2Minus !== null) {
      data.phi2 = (theta2Minus - theta2Plus) / 2;
    }

    // 计算平均衍射角和波长
    if (data.phi1 !== null && data.phi2 !== null) {
      // 计算平均衍射角
      data.phiAvg = (data.phi1 + data.phi2) / 2;

      // 使用 calculateWavelength 函数计算波长
      data.lambda = calculateWavelength(data.phiAvg);

      // 计算波长差和相对误差
      data.deltaLambda = Math.abs(data.lambdaStd - data.lambda);
      data.error = calculateError(line.color, data.lambda);
    }
  });
};

// 更新三棱镜数据
const updatePrismData = () => {
  // 转换第一条光线的位置数据
  const pos1I = convertToDecimal(
    prismData.value.line1Position1.degrees,
    prismData.value.line1Position1.minutes
  );
  const pos2I = convertToDecimal(
    prismData.value.line2Position1.degrees,
    prismData.value.line2Position1.minutes
  );
  const pos1II = convertToDecimal(
    prismData.value.line1Position2.degrees,
    prismData.value.line1Position2.minutes
  );
  const pos2II = convertToDecimal(
    prismData.value.line2Position2.degrees,
    prismData.value.line2Position2.minutes
  );

  // 计算角度差和面角
  if (pos1I !== null && pos2I !== null && pos1II !== null && pos2II !== null) {
    // 计算 |θ'I - θI| 和 |θ'II - θII|
    prismData.value.diffI = Math.abs(pos2I - pos1I);
    prismData.value.diffII = Math.abs(pos2II - pos1II);

    // 计算三棱镜面角 A = φ/2 = 1/4(|θ'I - θI| + |θ'II - θII|)
    prismData.value.A = (prismData.value.diffI + prismData.value.diffII) / 4;
  }
};

// 添加一个辅助函数来获取光谱线的颜色类名
const getSpectralLineClass = (color: string) => {
  switch (color) {
    case "蓝":
      return "spectral-blue";
    case "绿":
      return "spectral-green";
    case "黄1":
    case "黄2":
      return "spectral-yellow";
    default:
      return "";
  }
};
</script>

<template>
  <div class="spectrometer-experiment">
    <!-- 实验概述卡片 -->
    <div class="overview-card">
      <h2 class="card-title">分光计实验数据处理</h2>
      <p class="card-text">
        本实验通过分光计测量不同光谱线的衍射角，计算光的波长并与标准值进行对比分析。实验包括光谱测量和三棱镜面角测量两个部分。
      </p>
    </div>

    <!-- 数据记录表 -->
    <div class="data-card">
      <div class="card-header">
        <h3 class="section-title">表17-1 数据记录表</h3>
        <div class="badge badge-blue">光谱测量</div>
      </div>
      <!-- 数据输入表格 -->
      <div class="table-container">
        <table>
          <thead>
            <tr>
              <th scope="col" class="col-spectral">光谱线</th>
              <th scope="col" class="col-spectrum">光谱</th>
              <th scope="col" colspan="2" class="col-reading">游标读数</th>
            </tr>
            <tr>
              <th scope="col" />
              <th scope="col" />
              <th scope="col" class="reading-label">θ<sub>I</sub></th>
              <th scope="col" class="reading-label">θ<sub>II</sub></th>
            </tr>
          </thead>
          <tbody>
            <template v-for="line in spectralLines" :key="line.color">
              <tr>
                <td class="spectral-line" rowspan="2">
                  <span :class="getSpectralLineClass(line.color)">
                    {{ line.color }}
                  </span>
                </td>
                <td class="spectrum-level">+1 级</td>
                <td class="angle-input">
                  <div class="angle-input-group">
                    <input
                      v-model="line.readings[0].theta1.degrees"
                      type="number"
                      class="input-field"
                      placeholder="度"
                      @input="calculateProcessedData"
                    />
                    <span>°</span>
                    <input
                      v-model="line.readings[0].theta1.minutes"
                      type="number"
                      class="input-field"
                      placeholder="分"
                      min="0"
                      max="59"
                      @input="calculateProcessedData"
                    />
                    <span>'</span>
                  </div>
                </td>
                <td class="angle-input">
                  <div class="angle-input-group">
                    <input
                      v-model="line.readings[0].theta2.degrees"
                      type="number"
                      class="input-field"
                      placeholder="度"
                      @input="calculateProcessedData"
                    />
                    <span>°</span>
                    <input
                      v-model="line.readings[0].theta2.minutes"
                      type="number"
                      class="input-field"
                      placeholder="分"
                      min="0"
                      max="59"
                      @input="calculateProcessedData"
                    />
                    <span>'</span>
                  </div>
                </td>
              </tr>
              <tr>
                <td class="spectrum-level">-1 级</td>
                <td class="angle-input">
                  <div class="angle-input-group">
                    <input
                      v-model="line.readings[1].theta1.degrees"
                      type="number"
                      class="input-field"
                      placeholder="度"
                      @input="calculateProcessedData"
                    />
                    <span>°</span>
                    <input
                      v-model="line.readings[1].theta1.minutes"
                      type="number"
                      class="input-field"
                      placeholder="分"
                      min="0"
                      max="59"
                      @input="calculateProcessedData"
                    />
                    <span>'</span>
                  </div>
                </td>
                <td class="angle-input">
                  <div class="angle-input-group">
                    <input
                      v-model="line.readings[1].theta2.degrees"
                      type="number"
                      class="input-field"
                      placeholder="度"
                      @input="calculateProcessedData"
                    />
                    <span>°</span>
                    <input
                      v-model="line.readings[1].theta2.minutes"
                      type="number"
                      class="input-field"
                      placeholder="分"
                      min="0"
                      max="59"
                      @input="calculateProcessedData"
                    />
                    <span>'</span>
                  </div>
                </td>
              </tr>
            </template>
          </tbody>
        </table>
      </div>
    </div>

    <!-- 数据处理表 -->
    <div class="data-card">
      <div class="card-header">
        <h3 class="section-title">表17-2 数据处理表</h3>
        <div class="badge badge-green">自动计算</div>
      </div>
      <!-- 光栅常量说明 -->
      <div class="info-box">光栅常量 d = a+b = 1/300 mm</div>
      <!-- 计算结果表格 -->
      <div class="table-container">
        <table>
          <thead>
            <tr>
              <th scope="col" class="col-process">数据处理</th>
              <th scope="col" class="col-result">蓝</th>
              <th scope="col" class="col-result">绿</th>
              <th scope="col" class="col-result">黄1</th>
              <th scope="col" class="col-result">黄2</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td class="formula-cell">
                φ<sub>I</sub> = 1/2(θ<sub>I</sub><sup>-</sup> - θ<sub>I</sub
                ><sup>+</sup>)
              </td>
              <td class="result-cell">
                {{ formatToDMS(processedData["蓝"].phi1) }}
              </td>
              <td class="result-cell">
                {{ formatToDMS(processedData["绿"].phi1) }}
              </td>
              <td class="result-cell">
                {{ formatToDMS(processedData["黄1"].phi1) }}
              </td>
              <td class="result-cell">
                {{ formatToDMS(processedData["黄2"].phi1) }}
              </td>
            </tr>
            <tr>
              <td class="formula-cell">
                φ<sub>II</sub> = 1/2(θ<sub>II</sub><sup>-</sup> - θ<sub>II</sub
                ><sup>+</sup>)
              </td>
              <td class="result-cell">
                {{ formatToDMS(processedData["蓝"].phi2) }}
              </td>
              <td class="result-cell">
                {{ formatToDMS(processedData["绿"].phi2) }}
              </td>
              <td class="result-cell">
                {{ formatToDMS(processedData["黄1"].phi2) }}
              </td>
              <td class="result-cell">
                {{ formatToDMS(processedData["黄2"].phi2) }}
              </td>
            </tr>
            <tr>
              <td class="formula-cell">
                φ = 1/2(φ<sub>I</sub> + φ<sub>II</sub>)
              </td>
              <td class="result-cell">
                {{ formatToDMS(processedData["蓝"].phiAvg) }}
              </td>
              <td class="result-cell">
                {{ formatToDMS(processedData["绿"].phiAvg) }}
              </td>
              <td class="result-cell">
                {{ formatToDMS(processedData["黄1"].phiAvg) }}
              </td>
              <td class="result-cell">
                {{ formatToDMS(processedData["黄2"].phiAvg) }}
              </td>
            </tr>
            <tr>
              <td class="formula-cell">λ(= dsinφ)/(10⁻⁶m)</td>
              <td class="result-cell">
                {{ processedData["蓝"].lambda?.toFixed(4) || "-" }}
              </td>
              <td class="result-cell">
                {{ processedData["绿"].lambda?.toFixed(4) || "-" }}
              </td>
              <td class="result-cell">
                {{ processedData["黄1"].lambda?.toFixed(4) || "-" }}
              </td>
              <td class="result-cell">
                {{ processedData["黄2"].lambda?.toFixed(4) || "-" }}
              </td>
            </tr>
            <tr>
              <td class="formula-cell">λ标/(10⁻⁶m)</td>
              <td class="result-cell">0.4358</td>
              <td class="result-cell">0.5461</td>
              <td class="result-cell">0.5770</td>
              <td class="result-cell">0.5791</td>
            </tr>
            <tr>
              <td class="formula-cell">Δλ(= |λ标-λ|)/(10⁻⁶m)</td>
              <td class="result-cell">
                {{ processedData["蓝"].deltaLambda?.toFixed(4) || "-" }}
              </td>
              <td class="result-cell">
                {{ processedData["绿"].deltaLambda?.toFixed(4) || "-" }}
              </td>
              <td class="result-cell">
                {{ processedData["黄1"].deltaLambda?.toFixed(4) || "-" }}
              </td>
              <td class="result-cell">
                {{ processedData["黄2"].deltaLambda?.toFixed(4) || "-" }}
              </td>
            </tr>
            <tr>
              <td class="formula-cell">Er = Δλ/λ标×100%</td>
              <td class="result-cell">
                {{ processedData["蓝"].error?.toFixed(2) || "-" }}%
              </td>
              <td class="result-cell">
                {{ processedData["绿"].error?.toFixed(2) || "-" }}%
              </td>
              <td class="result-cell">
                {{ processedData["黄1"].error?.toFixed(2) || "-" }}%
              </td>
              <td class="result-cell">
                {{ processedData["黄2"].error?.toFixed(2) || "-" }}%
              </td>
            </tr>
          </tbody>
        </table>
      </div>
    </div>

    <!-- 三棱镜面角测量表 -->
    <div class="data-card">
      <div class="card-header">
        <h3 class="section-title">表17-3 三棱镜面角测量</h3>
        <div class="badge badge-purple">面角测量</div>
      </div>
      <!-- 三棱镜测量数据表格 -->
      <div class="table-container">
        <table>
          <thead>
            <tr>
              <th scope="col" class="col-measure">测量项</th>
              <th scope="col" class="col-theta">θ<sub>I</sub></th>
              <th scope="col" class="col-theta">θ<sub>II</sub></th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td class="measure-cell">光线1位置</td>
              <td class="angle-input">
                <div class="angle-input-group">
                  <input
                    v-model="prismData.line1Position1.degrees"
                    type="number"
                    class="input-field"
                    placeholder="度"
                    @input="updatePrismData"
                  />
                  <span>°</span>
                  <input
                    v-model="prismData.line1Position1.minutes"
                    type="number"
                    class="input-field"
                    placeholder="分"
                    min="0"
                    max="59"
                    @input="updatePrismData"
                  />
                  <span>'</span>
                </div>
              </td>
              <td class="angle-input">
                <div class="angle-input-group">
                  <input
                    v-model="prismData.line1Position2.degrees"
                    type="number"
                    class="input-field"
                    placeholder="度"
                    @input="updatePrismData"
                  />
                  <span>°</span>
                  <input
                    v-model="prismData.line1Position2.minutes"
                    type="number"
                    class="input-field"
                    placeholder="分"
                    min="0"
                    max="59"
                    @input="updatePrismData"
                  />
                  <span>'</span>
                </div>
              </td>
            </tr>
            <tr>
              <td class="measure-cell">光线2位置</td>
              <td class="angle-input">
                <div class="angle-input-group">
                  <input
                    v-model="prismData.line2Position1.degrees"
                    type="number"
                    class="input-field"
                    placeholder="度"
                    @input="updatePrismData"
                  />
                  <span>°</span>
                  <input
                    v-model="prismData.line2Position1.minutes"
                    type="number"
                    class="input-field"
                    placeholder="分"
                    min="0"
                    max="59"
                    @input="updatePrismData"
                  />
                  <span>'</span>
                </div>
              </td>
              <td class="angle-input">
                <div class="angle-input-group">
                  <input
                    v-model="prismData.line2Position2.degrees"
                    type="number"
                    class="input-field"
                    placeholder="度"
                    @input="updatePrismData"
                  />
                  <span>°</span>
                  <input
                    v-model="prismData.line2Position2.minutes"
                    type="number"
                    class="input-field"
                    placeholder="分"
                    min="0"
                    max="59"
                    @input="updatePrismData"
                  />
                  <span>'</span>
                </div>
              </td>
            </tr>
            <tr>
              <td class="measure-cell">θ'-θ</td>
              <td class="result-cell">
                <span class="result-badge">
                  {{ prismData.diffI?.toFixed(4) || "-" }}
                </span>
              </td>
              <td class="result-cell">
                <span class="result-badge">
                  {{ prismData.diffII?.toFixed(4) || "-" }}
                </span>
              </td>
            </tr>
            <tr>
              <td class="measure-cell">
                A = φ/2 = 1/4(|θ'<sub>I</sub> - θ<sub>I</sub>| + |θ'<sub
                  >II</sub
                >
                - θ<sub>II</sub>|)
              </td>
              <td class="result-cell" colspan="2">
                <span class="result-badge">
                  {{ prismData.A?.toFixed(4) || "-" }}
                </span>
              </td>
            </tr>
          </tbody>
        </table>
      </div>
    </div>
  </div>
</template>

<style scoped>
.spectrometer-experiment {
  padding: 20px;
}

/* 卡片基础样式 */
.overview-card,
.data-card {
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  padding: 24px;
  margin-bottom: 24px;
  transition:
    transform 0.3s,
    box-shadow 0.3s;
}

.overview-card:hover,
.data-card:hover {
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* 卡片标题和文本 */
.card-title {
  font-size: 24px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 16px;
}

.card-text {
  color: #4b5563;
}

/* 卡片头部 */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.section-title {
  font-size: 20px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 4px;
}

/* 徽章样式 */
.badge {
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 14px;
}

.badge-blue {
  background-color: #eff6ff;
  color: #1d4ed8;
}

.badge-green {
  background-color: #ecfdf5;
  color: #047857;
}

.badge-purple {
  background-color: #f5f3ff;
  color: #6d28d9;
}

/* 信息框 */
.info-box {
  background-color: #f9fafb;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
  color: #4b5563;
}

/* 表格容器 */
.table-container {
  overflow-x: auto;
}

/* 表格样式 */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  border: 1px solid #e5e7eb;
  padding: 12px;
  text-align: center;
  vertical-align: middle;
  font-size: 14px;
}

th {
  background-color: #f9fafb;
  font-size: 14px;
  font-weight: 500;
  color: #4b5563;
  white-space: nowrap;
}

/* 表格列宽设置 */
.col-spectral {
  width: 120px;
}

.col-spectrum {
  width: 80px;
}

.col-reading {
  text-align: center;
}

.col-process {
  text-align: center;
}

.col-result {
  text-align: center;
  width: 120px;
}

.col-measure {
  text-align: center;
  width: 150px;
}

.col-theta {
  text-align: center;
  width: 200px;
}

/* 单元格样式 */
.spectral-line {
  font-weight: 500;
  vertical-align: middle;
  text-align: center;
}

.spectral-blue {
  color: #2563eb;
}

.spectral-green {
  color: #059669;
}

.spectral-yellow {
  color: #d97706;
}

.spectrum-level {
  color: #4b5563;
  font-size: 14px;
  text-align: center;
}

.angle-input {
  vertical-align: middle;
  text-align: center;
}

.angle-input-group {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
}

.angle-input-group input {
  width: 60px;
  text-align: center;
}

.angle-input-group span {
  color: #6b7280;
  font-size: 14px;
}

.formula-cell {
  font-weight: 500;
  color: #111827;
  text-align: center;
  white-space: nowrap;
}

.result-cell {
  text-align: center;
  color: #111827;
  font-family: monospace;
}

.measure-cell {
  text-align: center;
  font-weight: 500;
  color: #111827;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  background-color: #f3f4f6;
  border-radius: 9999px;
  font-weight: 500;
  color: #1f2937;
  font-family: monospace;
}

/* 输入框样式 */
.input-field {
  width: 80px;
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  text-align: center;
  font-size: 14px;
  transition: all 0.2s;
}

.input-field:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

/* 移除数字输入框的上下箭头 */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

/* 响应式调整 */
@media (max-width: 768px) {
  .angle-input-group input {
    width: 50px;
  }

  .col-spectral {
    width: 100px;
  }

  .col-spectrum {
    width: 70px;
  }

  .col-result {
    width: 100px;
  }

  .col-measure {
    width: 120px;
  }

  .col-theta {
    width: 180px;
  }

  .section-title {
    font-size: 18px;
  }
}

@media (max-width: 640px) {
  th,
  td {
    padding: 8px;
    font-size: 14px;
  }

  .angle-input-group input {
    width: 40px;
  }

  .result-badge {
    padding: 2px 8px;
    font-size: 12px;
  }
}
</style>
